﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Commands.User.Commands;
using DotNet.Common.Command;
using ZLCMS.Commands.User.Commands.Agent;
using ZLCMS.Business.Util;

namespace ZLCMS.Web.SystemManage.Basics.Shop.Agent
{
    public partial class ProductSummary : System.Web.UI.Page
    {
        protected ZLCMS.Business.DwzFrame.FrameHelper _framePage;

        protected decimal SalesAmount { get; set; }
        protected int SalesCounter { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {

            _framePage = new ZLCMS.Business.DwzFrame.FrameHelper(this);

            LoadSalesSummaryParameter param = new LoadSalesSummaryParameter();

            //设置分页大小
            param.PageSize = _framePage.IsAjaxPagerPostBack ? _framePage.PageSize : 20;
            //设置页码
            param.PageIndex = _framePage.IsAjaxPagerPostBack ? _framePage.PageIndex : 1;

            param.End = DateTime.Parse(Request["end"]);
            param.Start = DateTime.Parse(Request["start"]);
            param.AgentAccount = Request["acc"];
            param.UserAccount = UserKit.GetUserAccount();

            ICommandResult<LoadSalesSummaryResult> result = new LoadSalesSummaryCommand().Execute(param);
            if (!result.Error)
            {
                repeater1.DataSource = result.Result.List;
                repeater1.DataBind();
                _framePage.RecordCount = result.TotalCount;
                SalesAmount = result.Result.TotalSalesAmount;
                SalesCounter = result.Result.TotalSalesCounter;
            }

        }
    }
}